function getCookie(key){
    const arr = document.cookie.split("; ");
    for(let i=0;i<arr.length;i++){
        const sArr = arr[i].split("=");
        if(sArr[0] === key){
            return (sArr[1]);
        }
    }
    return null;
}
function removeCookie(key, ops={}){
    ops.expires = -1;
    setCookie(key, "", ops);
}
function setCookie(key, val, ops={}){
    let p = "";
    if(ops.path){
        p = ";path="+ops.path;
    }
    let e = "";
    if(ops.expires){
        const d = new Date();
        d.setDate(d.getDate() + ops.expires);
        e = ";expires=" + d;
    }
    document.cookie = `${key}=${val}${p}${e}`;
}